/**
 * This class provides the modal Ext.Window support for all Authentication forms.
 * It's layout is structured to center any Authentication dialog within it's center,
 * and provides a backGround image during such operations.
 */
Ext.define('Monkey.view.code.PicUploadWindow', {
    extend: 'Ext.window.Window',
    xtype: 'picuploadwindow',

    requires: [
        'Monkey.view.code.TemplateController'
    ],

    controller: 'ctrl-codetemplate',
    closable: true,
    resizable: false,
    constrain: true,
    constrainHeader: true,
    modal: true,
    frameHeader: false,
    //frame: true,
    maximizable: false,
    title: '预览图片',
    width: 400,
    buttons: [{
        text: '确定',
        iconCls: 'accept',
        handler: 'acceptPicture'
    }, {
        text: '取消',
        iconCls: 'delete',
        handler: 'winCancel'
    }],
    initComponent: function () {
        this.items = [{
            xtype: 'form',
            border: false,
            bodyPadding: '10 10 2 10',
            items: [{
                xtype: 'filefield',
                name: 'file',
                fieldLabel: '预览图',
                labelWidth: 50,
                allowBlank: false,
                anchor: '100%',
                buttonConfig: {
                    text: '选择图片',
                    icon: 'resources/icons/16/picture_add.png'
                },
                listeners: {
                    change: 'uploadPicture'
                }
            }, {
                xtype: 'hidden',
                reference: 'templateId'
            }, {
                xtype: 'hidden',
                reference: 'picChanged',
                value: false
            }, {
                xtype: 'hidden',
                reference: 'path'
            }]
        }, {
            border: false,
            bodyPadding: '0 10 5 10',
            layout: {
                type: 'vbox',
                align: 'middle'
            },
            items: [{
                width: 350,
                height: 300,
                reference: 'prevImg',
                xtype: 'image',
                src: '/resources/images/no-image.png',
                alt: '模版预览图片'
            }]
        }];


        this.callParent();
    }
});
